@extends('admin.master')
        
@section('content')
            <h1>Apartments</h1>
            
            {{-- will be used to show any messages --}}
            @if (Session::has('message'))
            <div class="alert alert-info">{{ Session::get('message') }}</div>
            @endif
            
            <div class="table-responsive">
            <table id="sort" class="table table-hover table-bordered table-condensed">
                <thead>
                    <tr>
                        <th>Fecha</th>
                        <th>Lugar</th>
                        <th>Texto</th>
                        <th class="text-center">Estado</th>
                        <th class="text-center">Ver</th>
                        <th class="text-center">Editar</th>
                        <th class="text-center">Borrar</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($apartments as $key => $value)
                    <tr id="items_{{$value->id}}">
                        <td>{{ $value->fecha_formatted() }}</td>
                        <td>{{ $value->lugar }}</td>
                        <td>{{ Str::limit($value->texto, $limit = 30, $end = '...') }}</td>
                        <td class="text-center">
                            @if($value->estado)
                                <span class="glyphicon glyphicon-ok"></span>
                            @else
                                <span class="glyphicon glyphicon-minus"></span>
                            @endif
                        </td>

                        <!-- we will also add show, edit, and delete buttons -->
                        <td class="text-center">
                            <!-- show the objeto (uses the show method found at GET admin/objetos/{id} -->
                            <a class="btn btn-xs btn-success" target="_blank" href="{{ URL::to('admin/apartments/' . $value->id) }}"><span class="glyphicon glyphicon-search"></span></a>
                        </td>
                        <td class="text-center">
                            <!-- edit this objeto (uses the edit method found at GET /objetos/{id}/edit -->
                            <a class="btn btn-xs btn-info" href="{{ URL::to('admin/apartments/' . $value->id . '/edit') }}"><span class="glyphicon glyphicon-pencil"></span></a>
                        </td>
                        <td class="text-center">
                            {{-- delete the objeto (uses the destroy method DESTROY admin/objetos/{id} --}}
                            {{-- The DELETE HTTP verb is used when accessing the nerds.destroy route. 
                                Since you can’t just create a button or form with the method DELETE, 
                                we will have to spoof it by creating a hidden input field in our delete form. --}}
                                
                            {{ Form::open(array('url' => 'admin/apartments/' . $value->id)) }}
                            {{ Form::hidden('_method', 'DELETE') }}
                            {{ Form::button('<span class="ladda-label"><span class="glyphicon glyphicon-trash"></span></span>', ['type' => 'submit', 'class' => 'ladda-button delete-button btn btn-xs btn-danger', 'data-style'=>'zoom-in']) }}
                            {{-- Form::button('<span class="ladda-label"><span class="glyphicon glyphicon-trash"></span></span>', ['type' => 'submit', 'class' => 'ladda-button delete-button btn btn-xs btn-danger'] --}}
                            {{ Form::close() }}
                        </td>

                    </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
@stop

@section('js-footer')
@parent
{{ HTML::script('assets/admin/js/scripts.js') }}
@stop

